#define _CRT_SECURE_NO_WARNINGS 1
#include<stdio.h>
#include<stdlib.h>


typedef struct {
    int price;
    int volume;
} Beverage;

Beverage beverages[] = {
    {60, 600},
    {10, 250},
    {36, 200},
    {16, 100},
    {45, 300},
};
int beverageCount = sizeof(beverages) / sizeof(beverages[0]);

int calculateMaxPrice() {
    int maxPrice = 0;

    for (int i = 0; i < beverageCount; ++i) {
        for (int j = i + 1; j < beverageCount; ++j) {
            int totalVolume = beverages[i].volume + beverages[j].volume;
            if (totalVolume < 800) {
                for (int k = j + 1; k < beverageCount; ++k) {
                    totalVolume += beverages[k].volume;
                    if (totalVolume < 800) {
                        int totalPrice = beverages[i].price + beverages[j].price + beverages[k].price;
                        if (totalPrice > maxPrice) {
                            maxPrice = totalPrice;
                        }
                    }
                    else {
                        break;
                    }
                }
            }
        }
    }
    return maxPrice;
}

int main() {
    int maxPrice = calculateMaxPrice();
    printf("%d\n", maxPrice);
    return 0;
}
